NASA provides two temperature-related variables: T2M (temperature at 2 meters) and TS (surface temperature). A comparison shows that both are highly correlated, making one sufficient for analysis. Since T2M better represents the temperature experienced by a person, this project uses T2M. However, using TS would likely yield similar results.
Code
ggplot(df, aes(x = T2M, y = TS)) +geom_point() +geom_smooth(method ="lm", se =FALSE, color ="blue") +labs(title ="TS vs T2M",x ="T2M",y ="TS" ) +theme_minimal()
3 Findings
3.1 Trend Analysis
From the initial plot (Figure 1), surface temperature appears relatively stable over the years. However, applying linear regression estimates a gradual temperature increase of 0.018°C per year. While this may seem negligible, it amounts to approximately 0.9°C over a 50-year period.
Figure 1: Brunei BSB Monthly Temperature 1981-2023
lm_temp <-lm(T2M ~ YEAR, data = df)summary(lm_temp)
Call:
lm(formula = T2M ~ YEAR, data = df)
Residuals:
Min 1Q Median 3Q Max
-1.58327 -0.34923 0.01707 0.39578 2.00782
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -8.987713 3.999351 -2.247 0.025 *
YEAR 0.018083 0.001998 9.052 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5631 on 514 degrees of freedom
Multiple R-squared: 0.1375, Adjusted R-squared: 0.1358
F-statistic: 81.94 on 1 and 514 DF, p-value: < 2.2e-16
plot(decompose(t2m_ts))
Figure 2: Decomposition of T2M Time Series
Scholars argue that linear regression may not always be suitable for time series data, especially when strong stochastic trends or autocorrelation are present. However, our data exhibits stable seasonal cycles and randomness (Figure 2). Since a moving average is expected to produce a similar trend, we use linear regression for simplicity while acknowledging its limitations.
3.2 Extreme Events
From Figure 3, we observe temperature peaks in 1998 and 2023. This aligns with the El Niño cycle, indicating that Brunei is not immune to extreme weather events. Globally, both 1998 and 2023 were marked by extreme temperature anomalies, with both years experiencing record heat.
Code
# Aggregate time series by year (assuming monthly data)t2m_agg <-aggregate(t2m_ts, FUN = mean)# Convert to data frame for ggplotdf_t2m <-data.frame(Year =as.numeric(time(t2m_agg)), # Extract time indexTemperature =as.numeric(t2m_agg) # Extract values)# Create ggplotp <-ggplot(df_t2m, aes(x = Year, y = Temperature)) +geom_line(color ="blue", size =1) +geom_point(color ="red", size =2) +labs(title ="Average Yearly Temperature (T2M)",x ="Year",y ="Mean Temperature (°C)") +theme_minimal()# Convert to interactive plotggplotly(p)
Figure 3
3.3 Month Distribution
The following is the temperature distribution by months over the 40-year period. We see that temperature is hotter in mid year and cools off towards year and and start of new year.
boxplot(t2m_ts ~cycle(t2m_ts), names = month.abb, xlab =NULL, ylab ="Temperature (°C)", main ="Monthly Temperature Distribution")
4 Conclusion
This project can be summarised in three main points:
Temperature is gradually increasing in Brunei.
Brunei is not immune to El Niño effects. Extreme heat in 1998 & 2023 (aligning with global anomalies)
May is the hottest month in Brunei.
5 Acknowledgements
The author expresses gratitude to NASA POWER for the data used in the project.